<?php

session_start();

if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {

    header("Location: login.php");
}
//
include 'i_functions.php';
include 'i_ClaimInit.php';
//
//
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $ClaimID = $_GET['ClaimID'];
    //print "ClaimID=" . $ClaimID . "<br>";
    $ID = htmlspecialchars($ClaimID);

    //==========================================
    //	CONNECT TO THE LOCAL DATABASE
    //==========================================
    $user_name = "root";
    $pass_word = "haddons";
    $database = "PPI";
    $server = "127.0.0.1";

    $db_handle = mysql_connect($server, $user_name, $pass_word);
    $db_found = mysql_select_db($database, $db_handle);
    //
    $UE_Opts['Exit'] = "A";
    //$UE_Opts['Trace'] = true;
    $UE_Func = "ClaimEnq1";
    $UE_Code = $UE_Func . ".php";
    $_SESSION['Work'] = array();
    $ParamRec = "";
    $Data = "";
    $q = 0;
    //print $UE_Code . "<br>";
    if (is_file($UE_Code)) {
        include $UE_Code;
        $_SESSION['Work']['ClaimID'] = $ClaimID;
        $Val = $UE_Func($ParamRec, $Data, $q, $UE_Opts);
    }
    //
    include 'i_head.php';
    //
    $HTML = "<table id=\"Enq\" align=\"center\" cellspacing=\"1\"cellpadding=\"5\">";
    $Options = array();
    $Options['TableName'] = "claims,client";
    $Options['ID'] = $ClaimID;
    $Options["Filter"] = "claims.ID = '" . $ID . "' AND client.ID = ClientID";
    $Options['Trace'] = "Y";
    $HTML_A = BuildEnq("ClaimEnq1", $Options);
    //
    $Options = array();
    $Options['TableName'] = "claims,client";
    $Options['ID'] = $ClaimID;
    $Options["Filter"] = "claims.ID = '" . $ID . "' AND client.ID = ClientID";
    $HTML_B = BuildEnq("ClaimEnq2", $Options);
//
    $HTML_E = "<center><B><A HREF=\"./Form.php?Form=Reminder&Table=activity&ID=NEW\"><img src=\"./img/cal.gif\"> Add Reminder</A></B></center>";
    $csvFile = "ClaimActivity.csv";
    //$Columns = array();
    $Options = array();
    $Options['Title'] = "<center>Activity for this claim";
    $Options['Name'] = "activity";
    $Options['TableOpts'] = "Align=\"center\" cellspacing=\"2\"";
    $Options["Filter"] = "ClaimID = '" . $ClaimID . "'";
    $Options['Action'] = "./Form.php?Form=Action&Table=activity&ID=";
    $Options['AllowNew'] = "Y";
    $Columns = array("ID", "CreateDate", "ClaimID", "Type", "Status", "Details");
    $Result = BuildDataArray("activity", $csvFile, $Columns, $Options);
    $HTML_F = Array2Table($xData, $Columns, $Options);
//
    print "<table align=\"center\" ><tr><td>" . $HTML . $HTML_A . "</table></TD><td width=\"10\"> </td><TD>" . $HTML . $HTML_B . "</table></td></tr></table>". $HTML_E . $HTML_F . "<p>";
    include 'i_foot.html';
}
?>